module RandomUtil

  ALPHANUM = (('A'..'Z').to_a + ('0'..'9').to_a).freeze

  ALPHA = (('A'..'H').to_a + ('J'..'N').to_a + ('P'..'Z').to_a).to_a.freeze

  NUM = ('0'..'9').to_a.freeze

  def self.random_string(length = 5)
    Array.new(length) { ALPHANUM[rand(ALPHANUM.length)] }.join
  end

  def self.alternate_random_string(length = 6)
    Array.new(length) { |i| i%2==0 ? ALPHA[rand(ALPHA.length)] : NUM[rand(NUM.length)] }.join
  end

end
